package com.example.toutiao.ui.main.frg

import android.util.Log
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import com.example.toutiao.R
import com.example.toutiao.base.BaseFragment
import com.example.toutiao.ui.main.adpater.MinVideoAdapter
import com.example.toutiao.ui.main.model.MinVideoModel
import com.example.toutiao.ui.main.presenter.MinVideoPresenter
import com.example.toutiao.ui.main.view.MinVideoView
import kotlinx.android.synthetic.main.fragment_min_video_list.view.*

class MinVideoListFragment : BaseFragment<MinVideoView, MinVideoPresenter>(), MinVideoView {
    private var views:View?=null
    override fun getLayoutId(): Int =R.layout.fragment_min_video_list

    override fun initView(view: View) {
        view.rv_min_video.layoutManager= GridLayoutManager(activity,2)
        views=view
    }

    override fun initData() {
        getPresenter()!!.getMinVideoList()
    }

    override fun createPresenter(): MinVideoPresenter = MinVideoPresenter()

    override fun isRegister(): Boolean =false

    override fun <T> setData(data: T) {
        var mList=data as MutableList<MinVideoModel>
        views!!.rv_min_video.adapter= MinVideoAdapter(mList!!)
    }

    override fun setError(err: String) {

    }


}